//for testing purposes only.
//should emulate server that receive frames from sensors
//and transmit them to the clients connected.

var net = require('net');
var server = net.createServer(function(c) {
    console.log('server connected');

var t = setInterval(function() {
    //teach-in frame
    c.write("A55A0B07100802870004E9570088", 'hex');
    //corresponds to a normal frame from a SRH04 rH sensor.
    c.write("A55A0B070084990F0004E9570001A55A0B070084990F0004E9570001", 'hex');
}, 2000);

c.on('end', function() {
    clearInterval(t);
    console.log('server disconnected');
});

});

server.listen(5000, function() {
      console.log('server bound');
});
